import request from '../util/request.js'

export function getMenus(){
    return request({
        url:"/menus",
        method:"GET"
    })
}

export function getAllroles(){
    return request({
        url:"/roles",
        method:"GET"
    })
}

export function addNewRole(data={}){
    return request({
        url:"/roles",
        method:"POST",
		data:data
    })
}

export function removeRole(id){
    return request({
        url:`/roles/${id}`,
        method:"DELETE"
    })
}

export function getRole(id){
    return request({
        url:`/roles/${id}`,
        method:"GET"
    })
}

export function modifyRole(id,data={}){
    return request({
        url:`/roles/${id}`,
        method:"PUT",
		data:data
    })
}

export function settingRoleRights(id,data={}){
    return request({
        url:`/roles/${id}/rights`,
        method:"POST",
		data:data
    })
}

export function removeRoleRights(roleId,rightId){
    return request({
        url:`/roles/${roleId}/rights/${rightId}`,
        method:"DELETE"
    })
}
